home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue45 / Clinic / Server_Stub.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-11-02  |  997 b   |  43 lines

  1. unit Server_Stub;
  2.  
  3. interface
  4.  
  5. uses
  6.   CorbaObj, OrbPas;
  7.  
  8. type
  9.   ITest = interface
  10.     ['{1E4B84EE-D627-11D2-96EC-0060978E1359}']
  11.     function Get_DateAndTime: TDateTime;
  12.     property DateAndTime: TDateTime read Get_DateAndTime;
  13.   end;
  14.  
  15.   TTestStub = class(TCorbaStub, ITest)
  16.     function Get_DateAndTime: TDateTime;
  17.   end;
  18.  
  19.   TTestCorbaFactory = class
  20.     class function CreateInstance(const InstanceName: String): ITest;
  21.   end;
  22.  
  23. implementation
  24.  
  25. function TTestStub.Get_DateAndTime: TDateTime;
  26. var
  27.   OutBuf: IMarshalOutBuffer;
  28.   InBuf: IMarshalInBuffer;
  29. begin;
  30.   FStub.CreateRequest('Get_DateAndTime', True, OutBuf);
  31.   FStub.Invoke(OutBuf, InBuf);
  32.   Result := InBuf.GetDouble;
  33. end;
  34.  
  35. class function TTestCorbaFactory.CreateInstance(const InstanceName: String): ITest;
  36. begin
  37.   Result := CorbaFactoryCreateStub('IDL:Server/TestFactory:1.0', 'Test', InstanceName, '', ITest) as ITest
  38. end;
  39.  
  40. initialization
  41.   CorbaStubManager.RegisterStub(ITest, TTestStub);
  42. end.
  43.